home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Atari Compendium
/
The Atari Compendium (Toad Computers) (1994).iso
/
files
/
prgtools
/
langs
/
iconv8_l.arc
/
IDOL.ARC
/
FRACTION.IOL
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
Text File
|
1990-03-19
|
368 b
|
20 lines
class fraction(n,d)
method n()
return self.n
end
method d()
return self.d
end
method times(f)
return fraction(self.n * f$n(), self.d * f$d())
end
method asString()
return self.n||"/"||self.d
end
method asReal()
return real(self.n) / self.d
end
initially
if self.d=0 then stop("fraction: denominator=0")
end